//修改联系方式
function fix(){
	var tel=$("#tel").val();
	var firmId= window.localStorage.getItem("firmId");
	console.log("1:",tel);
	console.log("2",mail);
	$.ajax({
		url:'/firm/updateTel',
		type:'post',
		data:{firmId:firmId,tel:tel},
		success(result){
			alert("修改成功")
			doSelect();
		}
	})
}
function fix2(){

	var mail=$("#mail").val();
	var firmId=window.localStorage.getItem("firmId");

	console.log("2",mail);
	$.ajax({
		url:'/firm/updateTel',
		type:'post',
		data:{firmId:firmId,mail:mail},
		success(result){
			alert("修改成功")
			doSelect();
		}
	})
}
//查询个人资料请求
function doSelect(){
	var id= window.localStorage.getItem("firmId");
	$.ajax({
		url:'/firm/firmInfoManage/'+id,
		type:'get',
		success(result){
			console.log(result.data.firmInfo)
			var info = result.data.firmInfo;
			console.log("123:",info.firmTel)
			$("#firm").text(info.firmName);
			$("#person").text(info.legalperson);
			$("#tel").val(info.firmTel);
			$("#mail").val(info.firmEmail);
		}
	})
}

//发送留言
function sendMsg() {
	$.ajax({
		url: '/message/insertMsg',
		data: $('#msgForm').serialize(),
		type: 'post',
		success(result){
			alert("留言成功");
			$('#exampleModal').modal('hide');
		}
	})
}


var cheId;
//资质修改申请审核
function verifyRequest(){

	var formData=new FormData($("#beianForm")[0])
	$.ajax({
		url:'/certify/verifyRequest',
		type:'post',
		data:formData,
		cache:false,
		processData: false,
		contentType: false,
		success(request){
			if(request.code==1)
			{
				alert(request.message);
				$('#exampleModal2').modal('hide');
				var cheId= request.data.cheId;

				window.localStorage.setItem("cheId",cheId)
				window.localStorage.getItem("cheId")
				console.log("session",cheId)
				$.ajax({
					url:'/certify/getCheckStatus/'+cheId,
					type:'get',
					success(data){
						var check=data.data.check;
						if(check.checkstatus==0){
							$("#check").text("审核状态：成功")
						}
						if(check.checkstatus==1){
							$("#check").text("审核状态：失败"+request.data.certify.checkAdvice)
						}
						if(check.checkstatus==2){
							$("#check").text("审核状态：审核中")
						}

					}
				})

			}else {
				alert("申请失败，请联系管理员")
			}
		}
	})
}


//模态框

function showDialog(ths) {

	var $th=$(ths).parent().parent().children();
	var ywyName=$th.eq(8).text();
	var loainid=$th.eq(9).text();
	var ywyId=$th.eq(10).text();
	var firmId=$th.eq(11).text();
	console.log(loainid);
	console.log(ywyId);
	//业务员名字
	$('#ywy').text(ywyName);
	//申请贷款id
	$('#sloanId').val(loainid);
	//业务员id
	$("#ywyId").val(ywyId);
	//企业id
	$("#MfirmId").val(firmId);
	$('#exampleModal').modal('show');
}
//修改备案对话框
function fixbeian() {
	$('#exampleModal2').modal('show');
}

//轮播图
				var timer = null;
				var num = 0;
				
				//图片轮播
				function scroll(){
					timer = setInterval(go,3000);
				}
				
				
				function go(){
					num++;
					num%=3;
					$('#banner_pic').css('margin-left','-'+num*100+'%');
					$('#point').find('li').attr('class','');
					$('#point').find('li').eq(num).attr('class','in');
				}
				
				scroll();

//我要借入导航鼠标事件
				$('header').find('li').eq(2).on({
					mouseover:function(){
						$('.borrow_in_bg').css('display','block');
					},
					
					mouseout:function(){
						$('.borrow_in_bg').css('display','none');
					}
				})
				
				$('.borrow_in_bg').on({
					mouseover:function(){
						$(this).css('display','block');
						$('header').find('li').eq(2).find('span').attr('class','ul-img');
					},
					
					mouseout:function(){
						$(this).css('display','none');
						$('header').find('li').eq(2).find('span').attr('class','');
					}
				})
				
//我要借出导航鼠标事件
				$('header').find('li').eq(1).on({
					mouseover:function(){
						$('.lend_out_bg').css('display','block');
					},
					
					mouseout:function(){
						$('.lend_out_bg').css('display','none');
					}
				})
				
				$('.lend_out_bg').on({
					mouseover:function(){
						$(this).css('display','block');
						$('header').find('li').eq(1).find('span').attr('class','ul-img');
					},
					
					mouseout:function(){
						$(this).css('display','none');
						$('header').find('li').eq(1).find('span').attr('class','');
					}
				})
				
//导航三角图标
				$("#nav").find('li').each(function(index,elem){
					$(this).on({
						"mouseover":function(){
							if(index != 0){
								$(this).find("span").attr('class','ul-img');
							}
						},	
						"mouseout":function(){
							if(index != 0){
								$(this).find("span").attr('class','');
						}
						}
					})
				})
				
//首页-我需要钱-我要借入
				$("#btn1").click(function(){
					$(location).attr("href","/jump?pg=borrow");
				})
				
//borrow页面
				$("#borrow_content_btn1").click(function(){
					$(location).attr("href","/loan/getAllCoBand");
				})
				
//新闻-社区
				$(".news_content_message").find("li").each(function(index,elem){
					$(this).click(function(){
						$(location).attr("href","news_content ");
					})
				})
				
				
//隐藏选项卡
				$(".Right_Main").children("div").each(function(index,elem){
					if (index == 0) {
						$(this).show();
					} else{
						$(this).hide();
					}
				})
				
				$(".account_recharge_main2").hide();
				$(".BlackScreen").hide();
				$(".account_withdrawals_main_popup1, .account_withdrawals_main_popup2").hide();
				$(".borrow_list2_table2").hide();
				$(".borrow_list2_table3").hide();
				
				$(".momey_query_main_page2").hide();
				$(".momey_query_main_page3").hide();
				$(".momey_query_main_page2_table1_11").hide();
				$(".momey_query_main_page2_table1_12").hide();
				$(".momey_query_main_page2_table1_13").hide();
				
//账户充值
				$(".account_recharge_main_header").find('p').each(function(index,elem){
					$(this).click(function(){
						$(this).attr('class','lend_follow_main_right_header_focus').siblings('p').attr('class','');
						
						switch (index){
							case 0:
								$(".account_recharge_main1").show();
								$(".account_recharge_main2").hide();
								break;
							case 1:
								$(".account_recharge_main1").hide();
								$(".account_recharge_main2").show();
								break;
							default:
								break;
						}
					})
				})
				
//借入-我的借款列表
				$(".lend_follow_main_right_header").find('p').each(function(index,elem){
					$(this).click(function(){
						$(this).attr('class','lend_follow_main_right_header_focus').siblings('p').attr('class','');

						switch (index){
							case 0:
							//	$(".borrow_list2_table1").show();
								$(".borrow_list2_table2").show();
								$(".borrow_list2_table3").hide();
								break;
							case 1:

								//$(".borrow_list2_table1").hide();
								$(".borrow_list2_table3").show();
								$(".borrow_list2_table2").hide();
								break;
							case 2:
								//$(".borrow_list2_table1").hide();
								$(".borrow_list2_table2").hide();
								$(".borrow_list2_table3").show();
								break;
							default:
								break;
						}
					})
				})
//				绑定银行卡
			function bindCard() {
					findAllCard();
					$(".account_fund_management_main").hide()
					$(".upload_file_main").show();

				}
				//通过企业id查询该企业绑定的所有银行卡
			function findAllCard() {
				$.ajax({
					url:'/card/findAllCard/'+ window.localStorage.getItem("firmId"),
					type:'get',
					success:function (result) {
						console.log("card:",result.data.cards)
						let str='';
						$.each(result.data.cards,function (index,obj) {

							str+="<div class='col-md-4'><div class='panel panel-default'><div class='panel-body'><p style='font-size: 13px;margin-left: 160px;' onclick='deleteCard("+obj.id+")'><span>删除</span></p><img style='border-radius:50%;margin-botton: 9px;vertical-align: top;width: 48px;height: 48px; margin-top: -9px;' src='"+
								obj.cobankImg+"'/><strong  style='font-size: 14px; font-family: MicrosoftYaHei-Bold; color: #333; margin: 16px 30px 10px; width: 105px; overflow: hidden; -o-text-overflow: ellipsis; text-overflow: ellipsis; white-space: nowrap;'>"+obj.cobankName+"</strong>"+
								"<p><strong>卡号：</strong><span style='font-size: 14px; font-family: MicrosoftYaHei-Bold; color: #333; width: 105px; overflow: hidden; -o-text-overflow: ellipsis; text-overflow: ellipsis; white-space: nowrap;'>"+obj.cardNum+"</span></p>"+
							"<p><strong>持卡人：</strong><span>"+obj.phone+"</span></p></div> </div> </div>"

						})
						str+="<a onclick='showaddCard()'><div class='col-md-4' style='width: 253px;height: 139px'><div class='panel panel-default' style='height: 159px'><div class='panel-body'>" +
							"<strong style='text-align: center' >添加银行卡</strong></div> </div> </div></a>"
						$("#cardList").html(str)
					}
				})
			}
			function showaddCard(){
					console.log("========")
				$.ajax({
					url:'/card/getBank',
					type:'get',
					success:function (result) {
						console.log("bank:",result.data.coBanks);
						let	str='';
						str+="<select  id='cobankName' name='bankId' class='borrow_details_content_bg'><option>请选择...</option>";
					$.each(result.data.coBanks,function (index,obj) {
						str+="<option value='"+obj.cobankId+"'>"+obj.cobankName+"</option>"
					})
						str+="</select>"
						$("#allBank").html(str)
					}
				})
					$("#addCardModel").modal('show');
				}
				//添加银行卡
				function addCard() {
					$.ajax({
						url:'/card/addCard/'+ window.localStorage.getItem("firmId"),
						type:'post',
						data:$("#addCard").serialize(),
						success:function (result) {
							findAllCard();
							$("#addCardModel").modal('hide');
						}
					})
				}

				//删除卡
				function deleteCard(id) {
					if(confirm("是否删除该银行卡")){
						console.log("银行卡id:",id)
						$.ajax({
							url:'/card/deleteCard/'+id,
							type:'delete',
							success:function (result) {
								findAllCard();
							}
						})}


				}
				function selectLoanStatusis2() {
					$.ajax({
						url:'/loan/selectLoanStatusis2/'+ window.localStorage.getItem("firmId"),
						type:'post',
						success(result){
							if(result.data.loanInfo!=null) {
								var str = "";
								console.log("==========");

								$.each(result.data.loanInfo,function (index,obj) {
									console.log("0000",obj.firmName);
									str+="<tr><th><span class='lend_follow_main_right_table_span2'>"+obj.firmName+"</span></th>" +
										"<th><span class='lend_follow_main_right_table_span2'>"+obj.legalperson+"</span></th> "
										+"<th><span class='lend_follow_main_right_table_span2'>&yen;"+obj.loanAmount+"</span></th>"
										+"<th><span class='lend_follow_main_right_table_span2'>"+obj.cobankName+"</span></th>"
										+"<th><span class='lend_follow_main_right_table_span2'>"+obj.loanRate+"%</span></th>"
										+"<th><span class='lend_follow_main_right_table_span1'>"+obj.loanDeadline+"个月</span></th>"
									if(obj.loanStatus == 0){
										str+="<th th:if='obj.loanStatus eq 0'>审批成功</th>";
									}
									if(obj.loanStatus==1){
										str+="<th th:else='obj.loanStatus eq 1'>审批失败"+"<br/><span style='color: red'>原因:"+obj.advice+"</span></th>";
									}
									if(obj.loanStatus==2){
										str+="<th id='wait' th:else='obj.loanStatus eq 2'>审批中</th>";
									}
									str+="<th>"+obj.createtime+ "</th>"
										+"<th><span class='lend_follow_main_right_table_span1'>"+obj.name+"</span></th>"
										+"<th><span class='lend_follow_main_right_table_span1' style='display: none'>"+obj.loanId+"</span></th>"
										+"<th><span class='lend_follow_main_right_table_span1' style='display: none'>"+obj.checkId+"</span></th>"
										+"<th><span class='lend_follow_main_right_table_span1' style='display: none'>"+obj.firmId+"</span></th>"
										+ "<th><a onclick='deleteByStatus(" + obj.loanId + ")'>撤回</a> </th>"
										+"<th><button type='button' class='btn btn-primary btn-sm' data-toggle='modal' onclick='showDialog(this)' >在线留言</button></th></tr>";

								})

								$("#page3").html(str);//未审批
							}else {
								$("#page3").html("");
							}
						}

					})

				}
				var returnMoney;
				//还款
				function ImmediateRepay(returnId,returnntAmount) {

					$("#returnCard").modal('show')
						console.log("还款金额：",returnId,returnntAmount)
					returnMoney=returnntAmount
					$("#returnId").val(returnId)
					$("#putMoney").val(returnntAmount);
				}

				function confirmReturn(){
					$("#returnId").val()
					$("#putMoney").val();
					console.log("确定还款：",$("#putMoney").val())
					if(((returnMoney-$("#putMoney").val()))<0){
						alert("请填写正确金额")
						$("#returnCard").modal('hide')
					}else {
						$.ajax({
							url:'/return/confirmReturn/'+$("#returnId").val(),
							type:'post',
							data:{"putMoney":$("#putMoney").val()},
							success:function (result) {
								alert("还款成功")
								$("#returnCard").modal('hide')
								$.ajax({
									url:'/return/getAllPutLoanReturn',
									type:'get',
									success:function (result) {
										console.log("所有待还款：", result.data.re)
										let str=''
										$.each(result.data.re, function (index, obj) {
											str+="<tr><th>"+obj.cobankName+"</th><th>"+obj.loanAmount+"</th><th>"+obj.putMoney+"</th><th>"+obj.returnedAmount+"</th><th>"+obj.returnntAmount+"</th><th>"+obj.finalDate+"</th>" ;
											if(obj.overDate==0) {
												str += "<th><button style='color: blue'>未逾期</button></th>"
											}else {
												str += "<th><button style='color: blue'>已逾期</button></th>"
											}
											if(obj.returnntAmount!=0){
												str +="<th><input type='button' value='立即还款' style='color: blue' onclick='ImmediateRepay("+obj.returnId+","+obj.returnntAmount+")'></th>"
											}
										})
										str+="</tr>"
										$("#loanPutReturn").html(str)
									}
								})
							}
						})
					}
				}

				function deleteByStatus(firmId) {
					$.ajax({
						url: '/loan/deleteByLoanStatus/'+firmId,
						type: 'post',
						success(result) {
							alert("撤回成功");
							selectLoanStatusis2();
						}
					})
				}
				
//借出-我的借款列表
				var arr = [".momey_query_main_page2_table1_11",".momey_query_main_page2_table1_12",".momey_query_main_page2_table1_13"];
				
				$(".lend_follow_main_right_header").find('p').each(function(index,elem){
					$(this).click(function(){
						$(this).attr('class','lend_follow_main_right_header_focus').siblings('p').attr('class','');
						
						switch (index){
							case 0:
								$(".momey_query_main_page1").show();
								$(".momey_query_main_page2").hide();
								$(".momey_query_main_page3").hide();
								break;
							case 1:
								$(".momey_query_main_page1").hide();
								$(".momey_query_main_page2").show();
								$(".momey_query_main_page3").hide();
								break;
							case 2:
								$(".momey_query_main_page1").hide();
								$(".momey_query_main_page2").hide();
								$(".momey_query_main_page3").show();
								break;
							default:
								break;
						}
					})
				})
				
				$(".momey_query_main_page2_table1_menu1, .momey_query_main_page2_table1_menu2, .momey_query_main_page2_table1_menu3").click(function(){
					var a = $(this).attr('class');
					var num1 = a[a.length-1];
					
					var status = $(this).attr("data-status");
					
					if(status == "menuhide"){
						$(this).css("background-image","url(images/momey_query_main_hide.jpg)");
						$(arr[num1-1]).show();
						$(this).attr("data-status","menushow");
					}else{
						$(this).css("background-image","url(images/momey_query_main_show.jpg)");
						$(arr[num1-1]).hide();
						$(this).attr("data-status","menuhide");
					}
					
				})
				
				$(".lend_follow_main_left").find("p").each(function(index,elem){
					$.ajax({
						url:'/integral/getIntergralById/'+ window.localStorage.getItem("firmId"),
						type:'get',
						success(result){
							$(".account_fund_management_main_right_sp1").text(result.data.integral.integralval);
							$("#uName").text(window.localStorage.getItem("firmName"))
						}
					})
					$(this).click(function(){
//						先进行删除当前选择标签栏的span操作,防止获取内容时把span也一同获取
						$(this).find('span').remove();
						var TabName = $(this).html();
						var Page = index;
//						左侧选择
						$(this).css("background-color","#FFFFFF").siblings("p").css("background-color","#F8F8F8");
						$(this).append("<span style='color: #555555; float: right;'>&gt;</span>").siblings("p").find('span').empty();
						$(".lend_follow_main_title").find("h1").html(TabName);
						
//						选项卡切换
						$(".Right_Main").children("div").each(function(index,elem){
							if ($(this).attr("data-page") == Page) {
								//如果page=6查询
								var id=1;
								if(Page==2){
									findAllCard();
								}
								if(Page==1){
									selectLoanStatusis2();
								}
								if(Page==3){
									$.ajax({
										url:'/return/getAllPutLoanReturn/'+window.localStorage.getItem("firmId"),
										type:'get',
										success:function (result) {
											console.log("所有待还款：", result.data.re)
											let str=''
											$.each(result.data.re, function (index, obj) {
												str+="<tr><th>"+obj.cobankName+"</th><th>"+obj.loanAmount+"</th><th>"+obj.putMoney+"</th><th>"+obj.returnedAmount+"</th><th>"+obj.returnntAmount+"</th><th>"+obj.finalDate+"</th>" ;
													if(obj.overDate==0) {
														str += "<th><button style='color: blue'>未逾期</button></th>"
													}else {
														str += "<th><button style='color: blue'>已逾期</button></th>"
													}
													if(obj.returnntAmount!=0){
														str +="<th><input type='button' value='立即还款' style='color: blue' onclick='ImmediateRepay("+obj.returnId+","+obj.returnntAmount+")'></th>"
													}
											})
											str+="</tr>"
											$("#loanPutReturn").html(str)
										}
									})
								}
								if(Page==6){
									$.ajax({
										url:'/firm/firmInfoManage/'+ window.localStorage.getItem("firmId"),
										type:'get',
										success(result){
											if(result.data.certify.checkAdvice!=null){
										$("#check").text("审核状态失败:"+result.data.certify.checkAdvice)
											}
											let cheId;
										if((cheId=window.localStorage.getItem("cheId"))!=null){
											$.ajax({
												url:'/certify/getCheckStatus/'+cheId,
												type:'get',
												success(data){
													var check=data.data.check;
													if(check.checkstatus==0){
														$("#check").text("审核状态：成功")
													}
													if(check.checkstatus==1){
														$("#check").text("审核状态：失败"+request.data.certify.checkAdvice)
													}
													if(check.checkstatus==2){
														$("#check").text("审核状态：审核中")
													}

												}
											})
										}
											console.log(result.data.firmInfo)
											var info = result.data.firmInfo;
											var beian=result.data.certify;
											console.log("123:",info.firmTel)
											$("#firm").text(info.firmName);
											$("#person").text(info.legalperson);
											$("#tel").val(info.firmTel);
											$("#mail").val(info.firmEmail);
											$("#registerDate").text(beian.registerDate);
											$("#legalperson").text(beian.legalperson);
											if(result.data.certify.registerStatus==0){
												$("#registerStatus").text("存续");
											}else {
												$("#registerStatus").text("注销");
											}
											$("#registerMaterial").text(beian.registerMaterial);
											$("#businessType").text(beian.businessType);
											$("#contributors").text(beian.contributors);
											$("#staffSize").text(beian.staffSize);
											$("#creditCode").text(beian.creditCode);
											$("#taxNum").text(beian.taxNum);
											$("#registerNum").text(beian.registerNum);
											$("#identyNum").text(beian.identyNum);
											$("#firmName").text(beian.firmName);
											$("#industry").text(beian.industry);
											$("#businessScope").text(beian.businessScope);
											$("#certifyId").val(beian.certifyId)
											$("#legalperson1").val(beian.legalperson);
											$("#registerMaterial1").val(beian.registerMaterial);
											$("#businessType1").val(beian.businessType);
											$("#contributors1").val(beian.contributors);
											$("#staffSize1").val(beian.staffSize);
											$("#industry1").val(beian.industry);
											$("#businessScope1").val(beian.businessScope);
										}
									})
								}
								$(this).show();
							} else{
								$(this).hide();
							}
						})
					})
				})
				
//账户提现
				$(".BlackScreen").click(function(){
					$(".BlackScreen").hide();
					$(".account_withdrawals_main_popup1, .account_withdrawals_main_popup2").hide();
				});
				
				$(".account_withdrawals_main_form_a1").click(function(){
					$(".BlackScreen").show();
					$(".account_withdrawals_main_popup1").show();
				})
				
				$(".account_withdrawals_main_form_a2").click(function(){
					$(".BlackScreen").show();
					$(".account_withdrawals_main_popup2").show();
				})
				
				$(".account_withdrawals_main_popup1 h5 >span, .account_withdrawals_main_popup2 h5 >span").click(function(){
					$(".BlackScreen").hide();
					$(".account_withdrawals_main_popup1, .account_withdrawals_main_popup2").hide();
				})
				
//本金保障
				$(".Principal_protection_main").children("div").each(function(index,elem){
									if (index == 0) {
										$(this).show();
									} else{
										$(this).hide();
									}
					})
				
				$(".upload_message_main_left").find("p").each(function(index,elem){
					if(index == 0){
						$(this).css("background-color",'#CCCCCC');
					}
					$(this).click(function(){
						$(this).css("background-color",'#CCCCCC').siblings().css("background-color","");
						var page = index;
						var Name = $(this).text();
						var TabName = Name.substring(0,Name.length-1);
						$(".upload_message_main_right_title > h1") (TabName);
						
						$(".Principal_protection_main").children("div").each(function(index,elem){
							if (index == page) {
								$(this).show();
							} else{
								$(this).hide();
							}
						})
						
						
					})
				})
				
//发布借款
				$("#borrow_details_content_btn2").click(function(){
					$(location).attr("href","/jump?pg=borrow_success");
				})

//我要借入
				$("#lend_list_box2_table").find("tr").each(function(index,elem){
					if(index != 0){
							$(this).css("cursor","pointer");
						}
					$(this).click(function(){
							$(location).attr("href","lend_list_details ");
					})
				})

//信息
			$(".message_btn_bg").click(function(){
				$(location).attr("href","write_letter ");
			})
			
			$("#message_setting2").find("li").each(function(index,elem){
				$(this).click(function(){
					switch (index){
					case 0:
						$(location).attr("href","personal_center ");
						break;
					case 1:
						$(location).attr("href","safety_center ");
						break;
					case 2:
						$(location).attr("href","head_portrait ");
						break;
					case 3:
						$(location).attr("href","security ");
						break;
					case 4:
						$(location).attr("href","friends ");
						break;
					default:
						break;
				    }
				})
				
			})
			
			var onOff = true;
				
				function settings(onOff){
					if(onOff){
						$('#message_setting1').css('display','block');
						$('#message_setting2').css('display','block');
						
					}
					else{
						$('#message_setting1').css('display','none');
						$('#message_setting2').css('display','none');
						
					}
				}
					
					$('#person_message').find('li').eq(3).click(function(ev){
						onOff = true
						settings(onOff);
						
						return false;
					})
					
					$('#message_setting1').click(function(ev){
						onOff = false;
						settings(onOff);
						
						return false;
						
					})
				
				$('body').click(function(ev){
					onOff = false;
					settings(onOff);
				})

//好友
				$(".add_friends_bg").hide();
				$(".add_friends").hide();
				
				$("#friends_btn").click(function(){
					$(".add_friends_bg").show();
					$(".add_friends").show();
				})
				
				$(".add_friends_bg, .add_friends_header > span").click(function(){
					$(".add_friends_bg").hide();
					$(".add_friends").hide();
				});
				
//借款列表详情
				$(".lend_list_details_box2_page1").show();
				$(".lend_list_details_box2_page2").hide();
				
				
				$(".lend_list_details_box2_header").find('li').each(function(index,elem){
					$(this).click(function(){
						$(this).attr('class','lend_list_details_box2_header_status').siblings('li').attr('class','');
						switch (index){
							case 0:
							$(".lend_list_details_box2_page1").show();
							$(".lend_list_details_box2_page2").hide();
								break;
							case 1:
							$(".lend_list_details_box2_page1").hide();
							$(".lend_list_details_box2_page2").show();
								break;
							default:
								break;
						}
					})
					
					$(".personal_center_btn_bg1").find("p").click(function(){
						$(location).attr("href","private_letter ");
					})
					
					$(".personal_center_btn_bg2").find("p").click(function(){
						$(location).attr("href","error ");
					})
					
				})
				
//				我要投标按钮
				$(".BlackScreen").hide();
				$(".lend_list_details_box1_p2_btn_ev").hide();
				$("#lend_list_details_box1_p2_btn").click(function(){
					$(".BlackScreen").show();
					$(".lend_list_details_box1_p2_btn_ev").show();
				});
				
				$(".BlackScreen, .lend_list_details_box1_p2_btn_ev > h5 > span").click(function(){
					$(".BlackScreen").hide();
				$(".lend_list_details_box1_p2_btn_ev").hide();
				})
				
//注册

				//隐藏提示
				$('.register_main_message_tips').hide();
				$('.register_main_message_tips2').hide();
				
				//确认密码提示
				$('.register_main').find('input').eq(3).one({
					mousedown:function(){
				$('.register_main_message_tips').show();
						
						setTimeout(function(){
							$('.register_main_message_tips').hide();
							
						},3000)
					}
				})
				
				$('#register_main_btn').click(function(){
					
					$('.register_main').find('input[type = text], input[type = password], input[type = checkbox]').each(function(){
//						alert($('#register_main_checkbox').is(':checked'))
						var value = $(this).val();
							if(value == '' && $(this).attr('type') != 'checkbox'){
//								alert(value)
							$('.register_main_message_tips2').show();
								}
							
							else if($('#register_main_checkbox').is(':checked') == false){
							$('.register_main_message_tips2').show();
							}
							
							else{
							$('.register_main_message_tips2').hide();
							}
								
					
					})
					
				})
				
//封装一个 设置Cookie的函数：
function setCookie(key, value, t) {
	var oDate = new Date();
	oDate.setDate( oDate.getDate() + t );
	document.cookie = key + '=' + value + ';expires=' + oDate.toGMTString();
}

//封装一个 读取Cookie方法的函数：
function getCookie(key) {
	var arr1 = document.cookie.split('; ');
	for (var i=0; i<arr1.length; i++) {
		var arr2 = arr1[i].split('=');
		if ( arr2[0] == key ) {
			return decodeURI(arr2[1]);
		}
	}
}

//移除cookie
function removeCookie (key) {
setCookie(key, ' ', -1);
}


//退出
$('#leave').click(function(){
	removeCookie('username');
	$(location).attr('href','index.html');
})



